import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        //长度给到n+1防止越界
        int[] array = new int[n+1];
        for (int i = 0; i < n; i++) {
            array[i] = scan.nextInt();
        }
        int i = 0;
        int count = 0;
        while (i < n){
            //进入非递减子序列
            if (array[i] < array[i+1]){
                /*while (array[i] <= array[i+1]){
                    i++;
                }
                如果如上面代码所示删除“i < n”
                例如n = 3，当i下标为2时，会出现“array[2] < array[3]”导致数组越界*/
                while (i < n && array[i] <= array[i+1]){
                    i++;
                }
                count++;
                i++;
            }else if (array[i] == array[i+1]){
                i++;
            }else {//进入非递增子序列
                while (i < n && array[i] >= array[i+1]){
                    i++;
                }
                count++;
                i++;
            }
        }
        System.out.println(count);
    }
}
